/*
 *  Environment.h
 *  lab3
 *
 *  Created by Fredrik Gustafsson on 11/17/10.
 *  Copyright 2010 Kungliga Tekniska Högskolan. All rights reserved.
 *
 */

#ifndef _WOK2_ENVIROMENT
#define _WOK2_ENVIROMENT

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include "Item.h"
#include "Actor.h"

namespace wok2 {
	class Environment {

	protected:
		void print_directions() const;
		void print_items() const;
		void print_actors() const;
		std::vector<Item*> e_items;
		std::vector<Actor*> e_actors;
		std::map<std::string,Environment*> e_neighbors;
		virtual void print_room();
	public:
		bool locked;
		Environment(int i) : e_neighbors(std::map<std::string, Environment*>()), locked(false) {}
		virtual ~Environment();
		std::string name;
		std::string description;
		virtual std::string type() const =0;
		std::ostream& write_neighbors(std::ostream& os) const;
		std::ostream& write_items(std::ostream& os) const;
		std::ostream& write_actors(std::ostream& os) const;
		Environment* neighbor(std::string);
		Item* pop_item(std::string item);
		void push_item(Item*);
		Actor* pop_actor(std::string actor);
		Actor* peek_actor(std::string actor) const;
		void push_actor(Actor* actor);
		void add_neighbor(std::string, Environment& env);
		friend std::ostream& operator<<(std::ostream& os, Environment& env) {
			env.print_room();
			return os;
		}
	};
}

#endif
